// 对业务接口进行统一的管理
import {
	fetch
} from "./fetch.js";

// 对首页数据的请求
export const ApiGetHomeData = function() {
	return fetch('/index/index', {}, {}, 'GET');
}

// 登录接口
export const ApiLogin = (username, pwd) => fetch('/auth/loginByWeb', {
	username: username,
	pwd: pwd,
}, {})

//分类接口
export const Apicategory = function() {
	return fetch('/catalog/index', {}, {}, 'GET');
}

// 获取当前分类的信息
export const ApigetCategoryCurrent = (id) => fetch('/catalog/current?id=' + id, {}, {}, 'GET');


// 专题ApiGetTopic     /topic/list
export const ApiGetTopic = (params) => fetch('/topic/list', params, {}, 'GET');


//首页品牌制造详情
export const ApiBrandDetail = function(id) {
	return fetch('/brand/detail', {
		id
	}, {}, 'GET');
}

// 宫格/goods/category
export const ApiGetCate = function(id) {
	return fetch('/goods/category', {
		id
	}, {}, 'GET');
}


//新品首发请求
export const ApiGoodsDetail = function(id) {
	return fetch('/goods/detail', {
		id
	}, {}, 'GET');
}
//相关产品 /goods/related
export const ApiGoodsRelated = function(id) {
	return fetch('/goods/related', {
		id
	}, {}, 'GET');
}

//搜索框数据接口
export const ApisearchHistory = (params) => fetch('/search/index', {}, {}, 'GET');
//搜素实时功能
export const ApisearchKeyword = (keyword) => fetch('/search/helper', {
	keyword: keyword
}, {}, 'GET');
//搜索商品列表
export const ApisearchGoodsList = (data) => fetch('/goods/list', data, {}, 'GET');

//ApiGoodsList
export const ApiGoodsList = (params) => fetch('/goods/list', params, {}, 'GET');



// 购物车  (含编辑)
export const ApiCart = () => fetch("/cart/index", {}, {}, "GET")

// 点击切换商品选中状态（含全选）
export const ApiChecked = (param) => fetch("/cart/checked", param)


export const ApiChangeCartNum = (params) => fetch("/cart/update", params, {
	'content-type': 'application/json;charset=utf-8'
}, 'POST');

// 修改购物车选中状态
export const ApiCartCheckedAll = (params) => fetch('/cart/checked', params, {}, 'POST');
